<template>
    <div class="tableWrap">
        <a-table bordered :columns="columns" size="middle" :data-source="dataList" rowKey="name" :scroll="scroll" :pagination="false">
            <span slot="name" slot-scope="text, record">
                <template v-if="record.openFlag != 0">
                    <AnTableBtn :record="record" :text="text"></AnTableBtn>
                </template>
                <template v-else>{{ text }}</template>
            </span>
        </a-table>
    </div>
</template>
<script>
import { columnsData } from '../js/js';
const AnTableBtn = () => import('./AnTableBtn')

export default {
    name: 'AnalyTable',
    components: {
        AnTableBtn,
    },
    props: {
        type: {
            type: String,
            default: 'AnalysisLookColum',
        },
        dataList: {
            type: [Array, Object],
            default: () => []
        },
        scroll: {
            type: Object,
            default: () => { }
        }
    },
    data() {
        return {
            columns: [],
        }
    },
    mounted() {
        this.columns = columnsData[this.type];
    },
}
</script>
<style lang="less" scoped>
.tableWrap {
    ::v-deep {
        .ant-table-thead th {
            background-color: #f5f7fa;
        }
    }
}
</style>